#include <iostream>
#include <boost/bind.hpp>
#include <boost/function.hpp>

using namespace std;
using namespace boost;

typedef boost::function<void(int)> func;

class A
{
public:
	void setFunction(const func& fun)
	{
		function_ = fun;
	}

	void work()
	{
		int i = 10;
		function_(i);
	}
private:
	func function_;
};

class B
{
public:
void test_func(int i, char* p)
{
	cout << "i: " << i << "p: " << *p <<endl;
}
};

int main()
{
	A a;
	B b;
	char p = 'H';
	a.setFunction(boost::bind(&B::test_func, &b, _1, &p));
	a.work();
}
